import Vue from 'vue'
import Vuex from 'vuex'
import menus from "./modules/menus";

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    token: '',
    data: {},
    userInfo: {}
  },
  mutations: {
    // 将token存在vuex和本地
    SET_TOKEN: (state, token) => {
      state.token = token,
        localStorage.setItem("token", token)
    },
    SET_DATA: (state, data) => {
      state.data = data
    },

    saveUserInfo(state, userInfo) {
      state.userInfo = userInfo;
    }
  },
  actions: {

  },
  modules: {
    menus
  }
})
